
UserManager.RemoteMethods = function() {	
	this.remote = new Ext.app.RemoteCall({
		url : "../desktop/service" ,
		service : "userManager" ,
		type : "org.jwos.platform.service.UserManager"	
	});	
};

UserManager.RemoteMethods.prototype = {

    helloWorld : function(msg, OnSuccess, scope, timeout) {
        this.remote.invoke('helloWorld', msg, OnSuccess, scope, timeout);
    },
    
    queryAllUsers : function(OnSuccess, scope) {
        this.remote.invoke('queryAllUsers', null, OnSuccess, scope);
    },
    
    saveUser : function(user, OnSuccess, scope) {
        this.remote.invoke('saveUser', user, OnSuccess, scope);
    } 
    
};

var userManagerRemote = new UserManager.RemoteMethods();

Plugin.UserManagerWindow = Ext.extend(Ext.app.Module, {	
	
    init : function(){
        this.launcher = {
            text: 'User Manager',
            iconCls:'db-icn-user-manager',
            handler : this.createWindow,
            scope: this
        }
    },

    createWindow : function(){
        var desktop = this.app.getDesktop();
        var fm = desktop.getWindow('user-manager');
        if(!fm){
			fm = desktop.createWindow({id: 'user-manager'}, UserManager.UserManager);           
			fm.show();			
        } else {
            fm.show();  
        }
    }
});

Plugin.settings.push(new Plugin.UserManagerWindow());